package com.Biomedica.virtualpowerpoint;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;


	public class Sender
	{
		String Ip;
	    int Port;
	    
	   DatagramSocket s;
	   DatagramPacket p;
	   InetAddress address;
	    
	   public Sender() throws SocketException
	   {
		   
				s=new DatagramSocket();
			
		   
	   }
	   public void Connect(String ip,int port) throws UnknownHostException
	   {
		  
		   Ip=ip;
		   Port=port;
		   address=InetAddress.getByName(Ip);
		   
		   s.connect(address, port);
		   
	   }
	   public void Send(String Msg) throws IOException
	   {
		  
		   p=new DatagramPacket(Msg.getBytes(),Msg.length(),address,Port);
		   s.send(p);
		  
	   }
	
	}


